There’s no point in creating an array solely for the purpose of passing it to a ParamArray
parameter. Simply pass the elements
directly. They will be consolidated into an array automatically.
Noncompliant code example
Class SurroundingClass
Public Sub Base()
Method(New String() { "s1", "s2" }) ' Noncompliant: unnecessary
Method(New String(12) {}) ' Compliant
End Sub
Public Sub Method(ParamArray args As String())
' Do something
End Sub
End Class
Compliant solution
Class SurroundingClass
Public Sub Base()
Method("s1", "s2")
Method(New String(12) {})
End Sub
Public Sub Method(ParamArray args As String())
' Do something
End Sub
End Class